<?php
/**
 * Created by PhpStorm.
 * User: lys
 * Date: 2018/8/7
 * Time: 11:28
 */

namespace app\sgb\logic;
use think\Model;

class  MobileAuth extends Model{

    public $useTable = false;
    private $api = 'http://106.ihuyi.cn/webservice/sms.php';
    const API= 'http://106.ihuyi.cn/webservice/sms.php';
    const SESSION_MOBILE_CODE = 'mobile_code';
    private $api_account = 'cf_yunyao91';
    private $api_password = 'yy0391';


    function send_msg($mobile, $msg)
    {

        $params = array(
            'method' => 'Submit',
            'account' => $this->api_account,
            'password' => $this->api_password,
            'mobile' => $mobile,
            'content' => $msg
        );

        $res =httpSend(self::API, $params,'GET');

        $res = xml_to_array($res);
        if (isset($res['SubmitResult']['code']) && $res['SubmitResult']['code'] == '2'){
            $data['status'] = 'success';
            $data['msg']=$res['SubmitResult']['msg'];
        }else{
            $data['status'] = 'fail';
            $data['msg']=$res['SubmitResult']['msg'];

        }
        return $data;

    }
}
